<!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>设置</title>
    <link rel="stylesheet" type="text/css" href="../../css/api.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/style.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/member.css"/>
    <script type="text/javascript" src="../../script/jquery-1.9.1.min.js"></script>
    <script type="text/javascript" src="../../script/mobile.js"></script>
    <script type="text/javascript">
        window['adaptive'].desinWidth = 750;
        window['adaptive'].baseFont = 28;
        window['adaptive'].maxWidth = 750;
        window['adaptive'].init();
    </script>
</head>

<body>
<div id="header" style="height: 0.9rem; background: #fff; position: fixed; top: 0;left: 0; width: 100%; z-index: 99">
    <header class="header header-shadow">
        <div class="header-left">
            <div tapmode onclick="comeBack();" class="nav-left"><img class="icon-back" src="../../icon/icon-back.png"/>
            </div>
        </div>
        <h2>选择学科</h2>
    </header>
</div>
<div class="header-h" style="padding-top: 1.5rem;"></div>
<section class="html_section pr30 pl30">
    <ul class="setting_option f30" id="result">
        <!--<li tapmode class="between line_center c-666" onclick="choose()">
            <div>重庆</div>
            <img class="ml30 arr_move" src='../../icon/move.png'/>
        </li>-->
    </ul>
</section>
</body>

</html>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/common.js"></script>
<script type="text/javascript">
    var type;
    apiready = function () {
        setFixStatusBar(); //设置状态栏
        keybackListener()
        type = api.pageParam.type;
        console.log(JSON.stringify(api.pageParam))
        getData(type);
    };

    function getData(type) {
        pop.loading();
        var param = {type: type};
        getAjax(Interface.get_information, param, function (res) {
            var result = res.data;
            var html = '';
            if (result) {
                for (var i = 0; i < result.length; i++) {
                    html +='<li tapmode class="between line_center c-666" onclick=\'choose(' + result[i].id + ',"'+ result[i].title +'")\'>'
                        +'<div>'+result[i].title+'</div>'
                        +'<img class="ml30 arr_move" src=\'../../icon/move.png\'/>'
                        +'</li>';
                }
            }
            $("#result").html(html);
            pop.close();
        }, function (error) {
            console.log(JSON.stringify(error));
        })
    }

    function choose(id, name) {
        api.sendEvent({
            name: 'subject',
            extra: {
                id: id,
                name: name,
            }
        });
        comeBack();
    }


</script>
